-
Notifications
You must be signed in to change notification settings - Fork 234
POC: Code PyGMT logo in PyGMT #3849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
/format |
|
I feel the logo definition should be separated into a standalone method, similar to the method to plot the GMT logo. This would allow to plot the PyGMT logo by calling something like |
|
ruff v0.10.0 was released 2 hours ago causing the newly falling code style checks. |
Co-authored-by: Wei Ji <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
Co-authored-by: Dongdong Tian <[email protected]>
| wordmark : bool, str | ||
| Add the wordmark "PyGMT" and adjust its orientation relative to the visual. Set | ||
| to ``True`` or ``"horizontal"``, to add the wordmark at the right side of the | ||
| visual [Default]. Use ``"vertical"`` to place the wordmark below the visual | ||
| and ``False`` to add no wordmark. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering if we want to have the option to add the URL to the PyGMT website, similar as for the GMT logo?
| fig = pygmt.Figure() | ||
|
|
||
| # blue circle / hexagon for Earth | ||
| fig.plot( | ||
| x=0, | ||
| y=0, | ||
| region=region, | ||
| projection=projection, | ||
| style=f"{symbol}{diameter}c", | ||
| pen=f"0.5c,{color_blue}", | ||
| fill=color_bg, | ||
| perspective=perspective, | ||
| no_clip=True, # needed for corners of hexagon shape | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find it's more convenient to debug and tweak the logo with a frame and gridlines. Here, frame="+n" means not to plot the frame. When debugging, just change it to frame="afg".
| fig = pygmt.Figure() | |
| # blue circle / hexagon for Earth | |
| fig.plot( | |
| x=0, | |
| y=0, | |
| region=region, | |
| projection=projection, | |
| style=f"{symbol}{diameter}c", | |
| pen=f"0.5c,{color_blue}", | |
| fill=color_bg, | |
| perspective=perspective, | |
| no_clip=True, # needed for corners of hexagon shape | |
| ) | |
| fig = pygmt.Figure() | |
| fig.basemap( | |
| region=region, | |
| projection=projection, | |
| perspective=perspective, | |
| frame="+n", # Change it to `frame="afg"` for debugging. | |
| ) | |
| # blue circle / hexagon for Earth | |
| fig.plot( | |
| x=0, | |
| y=0, | |
| style=f"{symbol}{diameter}c", | |
| pen=f"0.5c,{color_blue}", | |
| fill=color_bg, | |
| perspective=True, | |
| no_clip=True, # needed for corners of hexagon shape | |
| ) |
| lines_compass = [ | ||
| ([-r0, -r2], [0, 0]), # horizontal lines | ||
| ([-r4, 0], [0, 0]), | ||
| ([r2, r0], [0, 0]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ([r2, r0], [0, 0]), | |
| ([r2, r0], [0, 0]), | |
| ([0, 0], [-r0, r0]), # vertical line |
| perspective=True, | ||
| ) | ||
| # arrow tail | ||
| fig.plot(x=[0, 0], y=[-2, -3.57], pen=f"12p,{color_red}", perspective=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| fig.plot(x=[0, 0], y=[-2, -3.57], pen=f"12p,{color_red}", perspective=True) | |
| fig.plot(x=[0, 0], y=[-2, -3.57], pen=f"12p,{color_red}", perspective=True) | |
| # Extra vertical compass line above letters "G" and "M". | |
| fig.plot(x=[0, 0], y=[-r4 * 0.9, r2], pen=f"5p,{color_yellow}", perspective=True) | |
| # space between red line and blue circle / hexagon | ||
| fig.plot(x=[0, 0], y=[4, 3.0], pen=f"18p,{color_bg}", perspective=True) | ||
| # red line | ||
| fig.plot(x=[0, 0], y=[4, 1.9], pen=f"12p,{color_red}", perspective=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| # space between red line and blue circle / hexagon | |
| fig.plot(x=[0, 0], y=[4, 3.0], pen=f"18p,{color_bg}", perspective=True) | |
| # red line | |
| fig.plot(x=[0, 0], y=[4, 1.9], pen=f"12p,{color_red}", perspective=True) | |
| # space between red line and blue circle / hexagon | |
| fig.plot(x=[0, 0], y=[r0, r2], pen=f"18p,{color_bg}", perspective=True) | |
| # red line | |
| fig.plot(x=[0, 0], y=[r0, r2], pen=f"12p,{color_red}", perspective=True) |
Description of proposed changes
Related to #1404 (comment), create the PyGMT logo in Python with PyGMT.
Figure.pygmtlogoorFigure.logo_pygmtas part of theFigureclass or addition to the methodFigure.logo(which plots the GMT logo)Preview:
Related to
TODO:
shape="circle" | "hexagon"orhex=False | TrueFigure.image)Figureclass or addition toFigure.logo.Issues:
Figureobjects using the saved eps files. Maybe this is not easy to handle when converting to a method of theFigureclasse.Reminders
make formatandmake checkto make sure the code follows the style guide.doc/api/index.rst.Slash Commands
You can write slash commands (
/command) in the first line of a comment to performspecific operations. Supported slash command is:
/format: automatically format and lint the code